<template>
	<view class="haoyao">
		<view class="biaoti">
			  <view class="sousuo">
			  	<input type="text" v-model="v1" />
				<view @click="diansousuo">
					确定
				</view>
			  </view>
			  <view class="wu" v-show="shuju.length>0?false:true">
			  	   <text>没有找到相关信息</text>
			  </view>
			   <view class="yao" 
			    v-for="(item) in shuju"
				 @click="tiao(item)"
			   >
			   	      <view class="yaoping">
			   	      	   <view class="yaotu">
			   	      	   	   <image :src="ip+item.yp_imgsrc" mode=""></image>
			   	      	   </view> 
						   <view >
						   	   <view>{{item.yp_mingcheng}}</view>
							   <view class="yaojiesao">￥{{item.yp_jiage}}</view>
						   </view>
			   	      </view>
			   </view>
		</view>
	</view>
</template>

<script>
	import {reactive,toRefs} from "vue"
	import http from "../../utils/http.js"
	import store from '../../store/index.js'
	import {mapState,useStore} from 'vuex'
	export default{
		setup(){
			const {state,getters,commit,dispatch} = useStore();
			let data=reactive({
				token:"",
				shuju:[],
				v1:"",
				ip:"http://localhost:8088",
				diansousuo:()=>{
					console.log(data.v1)
				   if(data.v1){
					   http({
					   	url:'/APPsousuo',
					   	method:"post",
					   	data:{
					   		token:data.token,
					   						neirong:data.v1
					   	}
					   }).then((res)=>{
					   	// console.log(res.data.data)
					   					data.shuju=res.data.data
					   }).catch((err)=>{
					   	console.log(err)
					   })
				   }
				   
				},
				tiao:(i)=>{
									 console.log(i)
									 // let v={
										//  id:i.yp_id,
										//  tit:i.yp_mingcheng,
										//  qian:"50",
										//  gg:"100",
										//  img:i.yp_imgsrc
									 // }
									 let v={
									 						 bo: i.yp_lubosrc,
									 						 gg: i.yp_guige,
									 						 gn: i.yp_zhuzhigongneng,
									 						 id: i.yp_id,
									 						 img: i.yp_imgsrc,
									 						 qian: i.yp_jiage,
									 						 shuo: i.yp_shuomingsrc,
									 						 tit: i.yp_mingcheng,
									 						 wh: i.yp_pizhunwenhao,
									 						 yf: i.yp_yunfei,
									 						 yfyl: i.yp_yongfayongliang,
									 }
									 console.log(v)
									 commit('classification/soo',v)
									 uni.navigateTo({
									 	url:"/pages/classification-Details/classification-Details"
									 })
				},
				dianji:()=>{
					uni.getStorage({
						key: 'token',
						success: function (res) {
							console.log(res.data);
						     data.token=res.data
						}
					})
					http({
						url:'/APPlunbo',
						method:"get",
						data:{
							token:data.token
						}
					}).then((res)=>{
						console.log(res)
					}).catch((err)=>{
						console.log(err)
					})
				}
			})
			return {...toRefs(data)}
		}
	}
</script>

<style scoped lang="scss">
	.sousuo{
		width: 750rpx;
		height: 100rpx;
		line-height: 100rpx;
		display: flex;
	}
	.sousuo >input{
		border: 1rpx solid #969896;
		width: 550rpx;
		height: 60rpx;
		margin-left: 30rpx;
		margin-top: 20rpx;
		border-radius: 10rpx;
		background-color: #f7f7f7;
		color: #bdbdbd;
	}
	.sousuo >view{
		margin-left: 15rpx;
		margin-top: 20rpx;
		border-radius: 10rpx;
		width: 130rpx;
		background-color: #B3D4FC;
		height: 60rpx;
		line-height: 60rpx;
		text-align: center;
		border: 1rpx solid #969896;
		cursor:pointer;
	}
	.wu{
		width: 750rpx;
		height: 150rpx;
		text-align: center;
		line-height: 150rpx;
		font-size: 1.2rem;
		color: #b5b5b5;
	}
	.biaoti{
		width: 750rpx;
		height: 70rpx;
		line-height: 70rpx;
		// border: 1rpx solid red;
	}
	.biaoti >text:first-child{
		margin-left: 20rpx;
		margin-right: 60rpx;
		font-size: 1.1rem;
	}
	.biaoti >text:last-child{
		color: red;
	}
	.yaoping{
		margin-top: 10rpx;
		width: 750rpx;
		height: 240rpx;
		display: flex;
		// border: 1rpx solid red;
		border-bottom: 1rpx solid #808080;
	}
	.yaotu{
		width: 250rpx;
		height: 300rpx;
		line-height: 300rpx;
		text-align: center;
	    // border: 1rpx solid red;
	}
	.yaotu >image{
		margin-top: 20rpx;
		width:180rpx;
		height: 180rpx;
		
	}
	.yaojiesao{
		color: red;
	}
</style>
